<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let nian = +prompt('请输入年份')
      let yue = +prompt('请输入月份')
      switch (yue) {
        case 1:
          alert('这个月有31天')
          break
        case 2:
          if (nian % 400 === 0 || (nian % 4 === 0 && nian !== 100)) {
            alert('这个月有29天')
          } else {
            alert('这个月有28天')
          }

          break
        case 3:
          alert('这个月有31天')
          break
        case 4:
          alert('这个月有30天')
          break
        case 5:
          alert('这个月有31天')
          break
        case 6:
          alert('这个月有30天')
          break
        case 7:
          alert('这个月有31天')
          break
        case 8:
          alert('这个月有31天')
          break
        case 9:
          alert('这个月有30天')
          break
        case 10:
          alert('这个月有31天')
          break
        case 11:
          alert('这个月有30天')
          break
        case 12:
          alert('这个月有31天')
          break
      }
    </script>
  </body>
</html>
